<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h1>
      这是一个测试文本
    </h1>
<button onclick="cookiesTest()">点击</button>
</body>
</html>
<script>
    function cookiesTest(){
        console.log("==============")
        let cookies = document.cookie;

        console.log(cookies);
        let xhr = new XMLHttpRequest();
        xhr.open('GET', 'http://localhost:8081/test', true);

        xhr.withCredentials = true;

        xhr.onreadystatechange = function() {
            if (xhr.readyState === 4 && xhr.status === 200) {
                let response = JSON.parse(xhr.responseText);
                console.log(response);
            }
        };
        xhr.send();
    }



</script>